export function dateToStr(time, format = "yyyy-MM-dd HH:mm:ss") {
    if (time && format) {
        let date = new Date(time);
        let year = String(date.getFullYear());
        let month = String(date.getMonth() + 1).padStart(2, "0");
        let day = String(date.getDate()).padStart(2, "0");
        let hours = String(date.getHours()).padStart(2, "0");
        let minutes = String(date.getMinutes()).padStart(2, "0");
        let seconds = String(date.getSeconds()).padStart(2, "0");

        return format
            .replace("yyyy", year)
            .replace("MM", month)
            .replace("dd", day)
            .replace("HH", hours)
            .replace("mm", minutes)
            .replace("ss", seconds);
    }
}